﻿
Imports osi.root.formation
Imports osi.root.procedure
Imports osi.root.connector
Imports osi.root.utils

Public Class manual_pre_generated_device_pool(Of T)
    Inherits pre_generated_device_pool(Of T)

    Public Sub New(ByVal max_count As UInt32,
                   ByVal identity As String,
                   Optional ByVal validator As Func(Of T, Boolean) = Nothing,
                   Optional ByVal closer As Action(Of T) = Nothing,
                   Optional ByVal device_id As Func(Of T, String) = Nothing,
                   Optional ByVal new_device_inserted_action As Action(Of T) = Nothing)
        MyBase.New(max_count, identity, Nothing, validator, closer, device_id, new_device_inserted_action)
    End Sub

    Public Sub New(ByVal max_count As UInt32,
                   Optional ByVal validator As Func(Of T, Boolean) = Nothing,
                   Optional ByVal closer As Action(Of T) = Nothing,
                   Optional ByVal device_id As Func(Of T, String) = Nothing,
                   Optional ByVal new_device_inserted_action As Action(Of T) = Nothing)
        MyBase.New(max_count, Nothing, validator, closer, device_id, new_device_inserted_action)
    End Sub

    Public Sub New(ByVal identity As String,
                   Optional ByVal validator As Func(Of T, Boolean) = Nothing,
                   Optional ByVal closer As Action(Of T) = Nothing,
                   Optional ByVal device_id As Func(Of T, String) = Nothing,
                   Optional ByVal new_device_inserted_action As Action(Of T) = Nothing)
        MyBase.New(identity, Nothing, validator, closer, device_id, new_device_inserted_action)
    End Sub

    Public Sub New(Optional ByVal validator As Func(Of T, Boolean) = Nothing,
                   Optional ByVal closer As Action(Of T) = Nothing,
                   Optional ByVal device_id As Func(Of T, String) = Nothing,
                   Optional ByVal new_device_inserted_action As Action(Of T) = Nothing)
        MyBase.New(Nothing, validator, closer, device_id, new_device_inserted_action)
    End Sub

    Protected NotOverridable Overrides Function create_device(ByVal r As pointer(Of T)) As event_comb
        assert(False)
        Return Nothing
    End Function

    Public Overloads Function insert(ByVal c As T,
                                     Optional ByVal close_if_fail As Boolean = True) As Boolean
        Return MyBase.insert_new_device(c, close_if_fail)
    End Function
End Class
